<?php /*
	*/ ?>
<?php
include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['memberid']))
{
header("location:customerlogin.php?cond=chngacc");
die();
}
// UPDATE the record
$sex="";
$email1="";
$fname1="";
$lname1="";
$birthdate1="";
$phoneno1="";
$faxno1="";
$p_add1="";
$p_code="";
$p_city="";
$p_state="";
$p_coun="";

if(isset($_SESSION['memberid']) && ($_SESSION['memberid'])!="")
{
		$memid =  $_SESSION['memberid'];
		//echo $memid;
		$sql = "select * from tblcustomers where intcusid ='$memid'";
		$result = $n02586916_db->select($sql);
		if(count($result)<=0)
		{
			echo " No Record Found!<br>";
			die();
		}
		if($result)
		{
			foreach($result as $row)
			{
				$email1 = $row['varcustemail'];
				$fname1 = $row['varcustfname'];
				$lname1 = $row['varcustlname'];
				$birthdate1 = $row['dtdob'];
				$sex = $row['charcustsex'];
				$p_add=$row['varstreetname'];
				$p_houseno=$row['varhouseno'];
				$p_add1=$p_houseno.$p_add;
				$p_code=$row['varpostalcode'];
				$p_city=$row['varcity'];
				$p_state=$row['varstate'];
				$p_coun=$row['varcountry'];
				$phoneno1 = $row['varcustphone'];
				$faxno1 = $row['varcustfax'];
			}
		}
		if(isset($_REQUEST['Submit']) && trim($_REQUEST['Submit']) == "Update")
		{
			$email = $_REQUEST['email'];
			$fname = $_REQUEST['fname'];
			$lname = $_REQUEST['lname'];
			$birthdate = $_REQUEST['dob'];
			if(isset($_REQUEST['radiobutton']) && $_REQUEST['radiobutton']=='Male')
			{
				$varsex = "Male";
			}
			if(isset($_REQUEST['radiobutton']) && $_REQUEST['radiobutton']=='Female')
			{
				$varsex = "Female";
			}
			$streetaddress=$_REQUEST['street'];
			$postcode=$_REQUEST['postcode'];
			$city=$_REQUEST['city'];
			$state=$_REQUEST['state'];
			$country=$_REQUEST['country'];
			$phoneno = $_REQUEST['phone'];
			$faxno = $_REQUEST['fax'];
					
			$sql_upd ="UPDATE tblcustomers SET charcustsex = '$varsex',
			 varcustfname = '$fname',
			 varcustlname = '$lname',
			  dtdob = '$birthdate', 
			  varcustemail = '$email', 
			  varcustphone = '$phoneno', 
			  varcustfax = '$faxno',
			  varstreetname='$streetaddress',
			  varpostalcode='$postcode',
			  varcity='$city',
			  varstate='$state',
			  varcountry='$country', 
			  dtregtime = NOW() 
			  WHERE intcusid ='$memid'";
			$result = $n02586916_db->sql_query($sql_upd);
			$errmsg = $mess['editacc'];
		}
	
}

?>
<?php include("inc/head.inc.php") ?>
<body>
<form name="acco" action="changeaccountinfo.php" method="post">
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php"); ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php"); ?></td>
        <td valign="top">
		<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr>
          <td height="23" class="head"><div class="pageheader">My Account</div></td>
        </tr>
		
        <tr>
          <td align="center"><span class="fontsmall">
            <?php if(isset($errmsg)) { echo $errmsg; } ?>
          </span></td>
        </tr>
        <tr>
          <td valign="top">
		
		 <table width="100%" border="0" cellpadding="0" cellspacing="1" class="prborderbg">
            <tr>
              <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;" colspan="5">&nbsp; Change Account Information </td>
              </tr>
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" align="left" class="font">Gender</td>
              <td width="2%" align="center">:</td>
              <td width="56%" class="fontsmall">
	    		<?php
				$sql = "select * from tblcustomers where intcusid ='$memid'";
				$result = $n02586916_db->select($sql);
				$sex=$result[0]['charcustsex'];
				 ?>
			    <input name="radiobutton" type="radio" value="Male" <?php if($sex=='Male'){ echo 'checked="checked"'; }?> />
                Male
                <input name="radiobutton" type="radio" value="Female" <?php if($sex=='Female'){ echo 'checked="checked"'; }?> />
                Female</td>
              <td width="2%">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">First Name </td>
              <td align="center">:</td>
              <td><input name="fname" type="text" class="feature_headingbg" id="fname" value="<?php echo $fname1;?>"/>              </td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Last Name </td>
              <td align="center">:</td>
              <td><input name="lname" type="text" class="feature_headingbg" id="lname" value="<?php echo $lname1;?>"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Date Of Birth </td>
              <td align="center">:</td>
              <td><input name="dob" type="text" class="feature_headingbg" id="dob" value="<?php echo $birthdate1;?>"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">E-Mail Address </td>
              <td align="center">:</td>
              <td><input name="email" type="text" class="feature_headingbg" id="email" value="<?php echo $email1;?>" readonly /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Telephone No</td>
              <td align="center">:</td>
              <td><input name="phone" type="text" class="feature_headingbg" id="phone" value="<?php echo $phoneno1;?>"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Evening Phone No</td>
              <td align="center">:</td>
              <td><input name="fax" type="text" class="feature_headingbg" id="fax" value="<?php echo $faxno1;?>"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Street Address </td>
              <td align="center" valign="top">:                </td>
              <td><input name="street" type="text" class="feature_headingbg" id="street" value="<?php echo $p_add1;?>"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="left"><span class="font">Town</span></td>
              <td align="center">:</td>
              <td align="left"><input name="city" type="text" class="feature_headingbg" id="city" value="<?php echo $p_city;?>"/></td>
              <td align="center">&nbsp;</td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="left"><span class="font">County</span></td>
              <td align="center">:</td>
              <td align="left"><input name="state" type="text" class="feature_headingbg" id="state" value="<?php echo $p_state;?>"/></td>
              <td align="center">&nbsp;</td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="left"><span class="font">Country</span></td>
              <td align="center">:</td>
              <td align="left"><input name="country" type="text" class="feature_headingbg" id="country" value="<?php echo $p_coun;?>"/></td>
              <td align="center">&nbsp;</td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="left"><span class="font">Postal Code</span></td>
              <td align="center">:</td>
              <td align="left"><input name="postcode" type="text" class="feature_headingbg" id="postcode" value="<?php echo $p_code;?>"/></td>
              <td align="center">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="5" align="center">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="5" align="center">
                <input name="Submit" type="submit" class="btn" value="Update" /></td>
              </tr>
          </table>
		 
		  </td>
        </tr> 
      </table>		</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</form>
</body>
</html>
